package cn.bdqnn.homework;

class NewThread implements Runnable{

	@Override
	public void run() {
		for(int i = 0; i < 50; i++) {
			try {
				Thread.sleep(300);
				System.out.println(Thread.currentThread().getName());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}
	
}

public class Demo02 {
	public static void main(String[] args) {
		Thread t1 = Thread.currentThread();
		Thread t2 = new Thread(new NewThread(), "new");

		t2.start();
		
		
		for (int i = 0; i < 100; i++) {
			System.out.println(t1.getName());
			try {
				Thread.sleep(500);		
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		
	}

}